package org.fangzz.cameramgr.cameramonitor.dto;

import org.fangzz.cameramgr.cameramonitor.model.DisplayResolution;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

public class DisplayResolutionSummary {
    private Integer id;

    private String resolution;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getResolution() {
        return resolution;
    }

    public void setResolution(String resolution) {
        this.resolution = resolution;
    }

    public static DisplayResolutionSummary convert(DisplayResolution model){
        DisplayResolutionSummary resolutionSummary = new DisplayResolutionSummary();
        BeanUtils.copyProperties(model, resolutionSummary);
        return  resolutionSummary;
    }

    public static List<DisplayResolutionSummary> convert(List<DisplayResolution> models){
        List<DisplayResolutionSummary> resolutionSummaries = new ArrayList<>();
        models.stream().forEach(DisplayResolution->{
            resolutionSummaries.add(DisplayResolutionSummary.convert(DisplayResolution));
        });
        return  resolutionSummaries;
    }
}
